package com.itheima.reggie.controller;

import com.itheima.reggie.common.R;
import com.itheima.reggie.entity.Orders;
import com.itheima.reggie.service.OrdersService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/order")
@Slf4j
public class OrdersController {
    @Autowired
    private OrdersService ordersService;

    //分页查询订单
    @GetMapping("/userPage")
    public R pageOrders(Integer page,Integer pageSize){
        return ordersService.pageOrders(page,pageSize);
    }

    //生成订单
    @PostMapping("submit")
    public R submitOrders(@RequestBody Orders orders){
        return ordersService.submitOrders(orders);
    }
}
